package com.ruoyi.project.system.mapper;

import java.util.List;
import java.util.Map;

import com.ruoyi.project.system.domain.QuestionStore;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 * [题库]Mapper接口
 * 
 * @author ruoyi
 * @date 2020-10-07
 */
@Mapper
public interface QuestionStoreMapper 
{
    /**
     * 查询[题库]
     * 
     * @param id [题库]ID
     * @return [题库]
     */
    public QuestionStore selectQuestionStoreById(Integer id);

    /**
     * 查询[题库]列表
     * 
     * @param questionStore [题库]
     * @return [题库]集合
     */
    public List<QuestionStore> selectQuestionStoreList(QuestionStore questionStore);

    /**
     * 新增[题库]
     * 
     * @param questionStore [题库]
     * @return 结果
     */
    public int insertQuestionStore(QuestionStore questionStore);

    /**
     * 修改[题库]
     * 
     * @param questionStore [题库]
     * @return 结果
     */
    public int updateQuestionStore(QuestionStore questionStore);

    /**
     * 删除[题库]
     * 
     * @param id [题库]ID
     * @return 结果
     */
    public int deleteQuestionStoreById(Integer id);

    /**
     * 批量删除[题库]
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    public int deleteQuestionStoreByIds(Integer[] ids);


    List<QuestionStore> selectByCourseCatalogId(Long courseCatalogId);


    /**
     *  获取考试列表，若未进行考试  ksScore字段为1000 进行考试则是该实际分数
     * @param collegeId 学校列表
     * @return
     */
    @Select("select A.* from college_paper as A where A.college_id=#{collegeId}")
    List<Map<String, Object>> getExamStudentList(Integer collegeId);



    /**
     *  获取考试列表，若未进行考试  ksScore字段为1000 进行考试则是该实际分数
     * @param collegeId 学校列表
     * @return
     */
    @Select("select A.*,1000 as ksScore from college_paper as A  where A.college_id=#{collegeId}")
    List<Map<String, Object>> getExamList(Integer collegeId);


    /**
     * 获取考试试卷列表
     * @param id 试卷id
     * @return
     */
    @Select("SELECT B.*,A.score from college_paper_question as A left join question_store as B on A.question_store_id = B.id where A.college_paper_id=#{id} ")
    List<Map<String, Object>> getExamInfoList(Integer id);
}
